package gui;

import java.awt.Toolkit;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.JFrame;
import javax.swing.UIManager;
/**
 * 所有窗体的基本窗体，定义了一个窗体的基本框架*/
public abstract class BaseFrame extends JFrame{
	/**获得屏幕的高度*/
	public final int HEIGHT = Toolkit.getDefaultToolkit().getScreenSize().height;
	/**获得屏幕的宽度*/
	public final int WEIGHT = Toolkit.getDefaultToolkit().getScreenSize().width;
	ClientContext context;
	public BaseFrame(){
		this.setLayout(null);
		String lookAndFeel = null;
		lookAndFeel = UIManager.getSystemLookAndFeelClassName();
		try {
			UIManager.setLookAndFeel(lookAndFeel);
		} catch (Exception e) {

		}
		this.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				System.out.println("x=" + e.getX() + ";y=" + e.getY());
			}
		});
		if (this.getFocusableWindowState()) {
			repaint();
		}
	}
	/**
	 * 窗口的初始化方法*/
	protected abstract void init();
	/**
	 * 显示窗体*/
	public void showView(){
		this.setResizable(false);
		this.setVisible(true);
		
		this.repaint();
	}
}
